import ora from "ora";

const spinner = ora("Loading").start();
let percent = 0;

spinner.color = "red";
spinner.text = "Loading " + percent + "%";
spinner.prefixText = "Download chalk";

export default function () {
  let task = setInterval(() => {
    percent += 10;
    spinner.text = "Loading " + percent + "%";
    if (percent === 100) {
      spinner.stop();
      spinner.succeed("Download finish!");
      clearInterval(task);
    }
  }, 500);
}
